<?php
    class datphongdb {
        public function Them($MaDP, $HoTen, $SDT, $NgayThue, $LoaiPhong, $LoaiGiuong, $SoLuong){
            $sql = "INSERT INTO `datphong`(`MaDP`, `HoTen`, `SDT`, `NgayDat`, `NgayThue`, `LoaiPhong`, `LoaiGiuong`, `SoLuong`, `TinhTrang`)"
                    +" VALUES($MaDP, $HoTen, $SDT, now(), $NgayThue, $LoaiPhong, $LoaiGiuong, $SoLuong, 'Chờ')";
            $data = new dataservice();
            return $data->ExecuteNoneQuery($sql);
        }
        
        public function Xoa($MaDP){
            $sql = "DELETE FROM `datphong` WHERE MaDP = $MaDP";
            $data = new dataservice();
            return $data->ExecuteNoneQuery($sql);
        }
        
        public function LayDanhSach($NgayThue, $TinhTrang){
            $sql = "SELECT `MaDP`, `HoTen`, `SDT`, `NgayDat`, `LoaiPhong`, `LoaiGiuong`, `SoLuong`"
                    +"FROM `datphong`   WHERE NgayThue = $NgayThue AND TinhTrang = $TinhTrang";
            $data = new dataservice();
            return $data->ExecuteQuery($sql);
        }
    }
?>